home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / tests / cnnctwth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  1.1 KB  |  31 lines

  1. #include <stdio.h>
  2. #include <Sender.h>
  3. #include <Receiver.h>
  4.  
  5. /* Usage: connectWithPortMgrTest <hostName>
  6.  *    where "hostName" is the name of the host on which the
  7.  *    PortManager is running.
  8.  */
  9.  
  10. main(int argc, char** argv)
  11. {
  12.   Sender*    sender;
  13.   Receiver*    receiver;
  14.   Port        senderPort;
  15.   int        result;
  16.  
  17.   printf("The Port Manager should be listening on port number %d.\n",
  18.      PortMgrPortNumber);
  19.   senderPort.hostName = argv[1];                    /* Where is the PortManager with which to connect? */
  20.   senderPort.portNumber = PortMgrPortNumber;                /* Defined constant to indicate PortManager's port number */
  21.   sender = NewSender(&senderPort);                    /* Try to make a communication link with the PortManager */
  22.   if (sender == (Sender*) NULL)                        /* Could not make a connection */
  23.     exit(1);
  24.   receiver = NewReceiver(sender,argv[0],AnyPort);            /* Try to register services with the PortManager */
  25.   if (receiver == (Receiver*) NULL)                    /* Could not register my services */
  26.     exit(1);
  27.   printf("Connected with the Port Manager.\n");
  28.   DestroyReceiver(sender, receiver);                    /* Disconnect with PortManager, free space taken by receiver */
  29.   exit(0);
  30. }
  31.